package com.vanlian.client;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.vanlian.client.logic.PayController;

public class MainActivity extends Activity implements PayController.PayBackLisener {

    String testPayNo=System.currentTimeMillis()+"";
    String testOrderId=System.currentTimeMillis()+"";
    String testPrice="0.01";
    String testTitle="首付款";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.wechatBt).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PayController.getInstance().wechatPay(testPayNo,testOrderId,testTitle,testPrice,MainActivity.this);
            }
        });
        findViewById(R.id.alipayBt).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PayController.getInstance().aliPay(MainActivity.this,testPayNo,testOrderId,testTitle,testPrice,MainActivity.this);
            }
        });
    }


    @Override
    public void onPaySuccess() {
         Toast.makeText(this, "pay Success", Toast.LENGTH_LONG).show();
    }

    @Override
    public void onPayFail() {
        Toast.makeText(this, "pay fail", Toast.LENGTH_LONG).show();
    }
}
